{\rtf1\ansi\ansicpg1252\cocoartf1187\cocoasubrtf390
{\fonttbl\f0\fswiss\fcharset0 Helvetica;}
{\colortbl;\red255\green255\blue255;}
\margl1440\margr1440\vieww11900\viewh8780\viewkind0
\pard\tx720\tx1440\tx2160\tx2880\tx3600\tx4320\tx5040\tx5760\tx6480\tx7200\tx7920\tx8640\pardirnatural

\f0\fs24 \cf0 p1->p2->p3\'85->pn\
\
int head_level; \
Node *p = findKthToLast(head, k, head_level);\
\
Node * findKthToLast(Node *node, int k, int &level) \
\{\
    Node *n = NULL;\
    if (node == NULL) \{\
        *level = 0;  // empty element\
        return n;\
    \} else \{\
        n = findKthToLast(node->next, k, level);\
        level = level + 1;\
    \}\
    if (level == k)\
        return node; \
    return n;\
\}}